package com.windoent.yugioh.adapter.brvah;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.windoent.yugioh.R;
import com.windoent.yugioh.bean.OnGoingHasEndLunBean;
import com.windoent.yugioh.utils.BaseMethod;

import java.util.List;

/**
 * author : robert
 * date   : 2021/5/6 15:26
 * desc   :
 */
public class SaiGuoTitleAdapter extends BaseQuickAdapter<OnGoingHasEndLunBean.DataBean.AgainstResultOffBean, BaseViewHolder> {

    public SaiGuoTitleAdapter() {
        super(R.layout.item_saiguo_title_main, null);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, OnGoingHasEndLunBean.DataBean.AgainstResultOffBean item) {
        helper.setText(R.id.tv_title, BaseMethod.notNullDefaultValueNull(item.getTitle()));
        List<OnGoingHasEndLunBean.DataBean.AgainstResultOffBean.ResultBean> result = item.getResult();
        RecyclerView recyclerView = helper.getView(R.id.recycler_view_main);
        recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
        SaiGuoTitleContentAdapter adapter = new SaiGuoTitleContentAdapter();
        adapter.setNewInstance(result);
        recyclerView.setAdapter(adapter);
    }
}